package create.abstract_factory;

public class ShapeFactory extends AbstractFactory{

	@Override
	public Animal getAnimal(String name) {
		return null;
	}

	@Override
	public Shape getShape(String name) {

		Shape shape;
		switch(name){
			case "Square": 
				shape = new Square();
				break;
			case "Circle":
				shape = new Circle();
				break;
			default: 
				throw new RuntimeException("参数错误");				
		}
		return shape;
	}
}

interface Shape{
	void draw();
}


class Square implements Shape {
	   @Override
	   public void draw() {
	      System.out.println("--Square--");
	   }
	}
class Circle implements Shape {
	   @Override
	   public void draw() {
	      System.out.println("---Circle---");
	   }
}